﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Collections.ObjectModel;

namespace XAMLStylePad.Models
{
    /// <summary>
    /// Base class for project models
    /// </summary>
    [Serializable]
    public abstract class ProjectBase 
    {
        public ProjectBase()
        {
            Sources = new ObservableCollection<SourceBase>();
        }
        /// <summary>
        /// Project file name
        /// </summary>
        public string Name
        {
            get;
            set;
        }

        /// <summary>
        /// Project directory
        /// </summary>
        public string Directory
        {
            get;
            set;
        }

        /// <summary>
        /// Full path 
        /// </summary>
        public string FullPath
        {
            get
            {
                return _FullPath;
            }
            set
            {
                Name = Path.GetFileName(value);
                Directory = Path.GetDirectoryName(value);
                _FullPath = value;
            }
        }
        string _FullPath;

        /// <summary>
        /// Collection of project's sources - xaml files or assemblyes
        /// </summary>
        public ObservableCollection<SourceBase> Sources
        {
            get;
            protected set;
        }

        /// <summary>
        /// Is this project new
        /// </summary>
        public virtual bool IsNew
        {
            get;
            set;
        }

        /// <summary>
        /// Check if project is read only 
        /// </summary>
        public virtual bool IsReadOnly
        {
            get;
            set;
        }

        /// <summary>
        /// Save project
        /// </summary>
        /// <param name="path">Path to project file</param>
        public abstract void Save(string path);
    }
}